<?php
/* @var $this DanhmucController */
/* @var $model Danhmuc */
?>
<div class="row-fluid">
    <div class="span12">
        <ul class="quick-actions-horizontal pull-right">
            <li>
                <a href="<?php echo Yii::app()->createAbsoluteUrl('product/create'); ?>">
                    <i class="icon-plus"></i>
                    <span>Thêm sản phẩm mới</span>
                </a>
            </li>
        </ul>
    </div>
</div>
<div class="row-fluid">
<div class="span12">
<div class="widget-box">
<?php $this->widget('bootstrap.widgets.TbGridView', array(
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
        array(
            'id'             => 'autoId',
            'class'          => 'CCheckBoxColumn',
            'selectableRows' => '50',
        ),
        array(
            'name'   => 'avatar',
            'value'  => '"<a href=\"".Yii::app()->request->baseUrl.$data->avatar."\"  class=\"preview\"><img src=\"".Yii::app()->request->baseUrl.$data->avatar."\" width=\"50\" height=\"50\"/></a>"',
            'type'   => 'raw',
            'filter' => FALSE,
            'sortable'   => FALSE,
        ),
        array(
            'name'   => 'categoryId',
            'value'  => 'isset($data->category)?$data->category->name:""',
            'filter' => CHtml::activeDropDownList($model, 'categoryId', CHtml::listData(Category::model()->findAll(), "id", "name"), array("empty" => "Chọn chuyên mục")),
        ),
        array(
            'name'        => 'name',
            'value'       => 'CHtml::textField("setName[$data->id]",$data->name,array("style"=>"width:150px;"))',
            'type'        => 'raw',
            'htmlOptions' => array("width" => "150px"),
        ),
        array(
            'name'        => 'rank',
            'value'       => 'CHtml::textField("sortRank[$data->id]",$data->rank,array("style"=>"width:50px;"))',
            'type'        => 'raw',
            'htmlOptions' => array("width" => "50px"),
        ),
        array(
            'name'        => 'price',
            'value'       => 'CHtml::textField("setPrice[$data->id]",$data->price,array("style"=>"width:50px;"))',
            'type'        => 'raw',
            'htmlOptions' => array("width" => "50px"),
        ),
        array(
            'name'   => 'status',
            'value'  => '$data->status==1?"Hiện":"Ẩn"',
            'filter' => array(1 => 'Hiện', 0 => 'Ẩn'),
        ),
        array(
            'name'   => 'home',
            'value'  => '$data->home==1?"Có":"Không"',
            'filter' => array(1 => 'Có', 0 => 'Không'),
        ),
        array(
            'name'   => 'feature',
            'value'  => '$data->feature==1?"Có":"Không"',
            'filter' => array(1 => 'Có', 0 => 'Không'),
        ),
        array(
            'class' => 'CButtonColumn',
        ),

	),
)); ?>
</div>
</div>
</div>
